package name.rainman.examples.osgi.quoteservice;

import java.util.Hashtable ;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

import name.rainman.examples.osgi.quote.IQuoteService;
import name.rainman.examples.osgi.quoteservice.internal.QuoteService;

public class Activator implements BundleActivator {

	private static BundleContext context;

	static BundleContext getContext() {
		return context;
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext bundleContext) throws Exception {
		Activator.context = bundleContext;
		IQuoteService qs = new QuoteService() ;
		context.registerService(IQuoteService.class.getName(), qs, null);
		System.out.println( "IQuoteService is registed!") ;		
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext bundleContext) throws Exception {
		Activator.context = null;
	}

}
